//
//  Kylin_HallTableViewController.m
//  01-LotteryBaseFrame
//
//  Created by Kylin on 16/1/4.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "Kylin_HallTableViewController.h"
#import "UIImage+Kylin_image.h"
#import "Kylin_Cover.h"
#import "Kylin_PopMenu.h"

@interface Kylin_HallTableViewController ()<kylin_PopMenuDelegate>

@end

@implementation Kylin_HallTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIImage *imgae = [UIImage imageWithRenderingImageName:@"CS50_activity_image"];
    
    
    // 设置左边barBarButtonItem 图片
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:imgae style:UIBarButtonItemStylePlain target:self action:@selector(leftBarButtonOnClick)];
 
    
}

- (void)leftBarButtonOnClick{
    
    
    [Kylin_Cover show];
    
    Kylin_PopMenu *popMenu = [Kylin_PopMenu showInCenter:self.view.center];
    
    // 设置当前View为popMenu的代理
    popMenu.delegate = self;
    
//    popMenu.x = 10;
//    popMenu.y = 10;
    
}

// 2:popMuenu点击了关闭按钮时执行代理方法
- (void)popMenuDidOnClick:(Kylin_PopMenu *)popMenu{
    
    // 3:代理调用 popMuenu 的hide方法法传入一个中心点
    [popMenu hideInCenter:CGPointMake(44, 44) completion:^{
        [Kylin_Cover hide];
    }];
    
    // 5:移除popMuenu后 隐藏Cover
    
}




@end
